package com.msb.system.web;


import com.msb.commons.ResponseResult;
import com.msb.commons.ResponseResultFactory;
import com.msb.system.annotation.NotBlankOrNull;
import com.msb.system.entity.UserEntity;
import com.msb.system.info.UserInfo;
import com.msb.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

@RestController
@RequestMapping("/user")
@Validated
public class UserController {
    @Autowired
    UserService userService;

    @PostMapping("/addUser")
    public ResponseResult addUser(@RequestBody UserEntity userEntity) {
        boolean result = userService.addUser(userEntity);
        return ResponseResultFactory.buildResponseResult();
    }

    @DeleteMapping("/delUser")
    public ResponseResult delUser(@RequestParam("ids") @NotBlankOrNull String ids) {
        boolean result = userService.delUser(ids);
        return ResponseResultFactory.buildResponseResult();
    }
}
